package com.zifeiyu.springbootaop.aop;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 实现CommandLineRunner
 * springboot项目启动后执行立即执行的内容
 * <br>
 * 多个类实现CommandLineRunner接口时
 *
 * @Order注解决定执行顺序 注解的执行优先级是按value值从小到大顺序。
 *
 */
@Component
@Order(1)
public class AfterStartRunner implements CommandLineRunner {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    /*** 
     * @description:spring项目启动后执行此方法
     *
     * @param: args 
     * @return: void 
     * @author lxh96
     * @date: 2021/8/15 11:06
     */ 
    @Override
    public void run(String... args) throws Exception {
        logger.info("项目启动后执行的方法");
        logger.debug("after start debug.....");
        logger.info("after start info.....");
        logger.warn("after start warning .....");
    }
}
